import type { DeleteRoleReq, QueryRoleAuthorityReq, QueryRoleReq, RoleInOrUpReq, UpdateRoleAuthorityReq } from './roleType'
import request from '@/utils/http/request'

/**
 * 角色分页查询
 */
export function getRolePage(data: QueryRoleReq) {
  return request.post<any>({
    url: '/pm-system/api/v1/role/page',
    method: 'post',
    data,
  })
}

/**
 * 角色保存
 */
export function saveRole(data: RoleInOrUpReq) {
  return request.post<any>({
    url: '/pm-system/api/v1/role/save',
    method: 'post',
    data,
  })
}

/**
 * 角色权限查询
 */
export function getRolePermission(data: QueryRoleAuthorityReq) {
  return request.post<any>({
    url: '/pm-system/api/v1/role/queryRoleAuthority',
    method: 'post',
    data,
  })
}

/**
 * 更新角色权限
 */
export function updateRolePermission(data: UpdateRoleAuthorityReq) {
  return request.post<any>({
    url: '/pm-system/api/v1/role/updateRoleAuthority',
    method: 'post',
    data,
  })
}

/**
 * 角色删除
 */
export function deleteRole(data: DeleteRoleReq) {
  return request.post<any>({
    url: '/pm-system/api/v1/role/delete',
    method: 'post',
    data,
  })
}
